/*
 * @Author: your name
 * @Date: 2021-09-18 20:06:42
 * @LastEditTime: 2021-09-18 20:06:43
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \egg-example\mysql.js
 */
const mysql = require("mysql")

let con = mysql.createConnection({
    port: '3306',
    host: "localhost",
    user: "root",
    password: "326422",
    database: "shequ"
})
con.connect()
function query(sql) {
    return new Promise((resolve, reject) => {
        con.query(sql, (err, data) => {
            if (err) reject(err)
            if (data) resolve(data)
        })
    })
}

module.exports = query